﻿
Imports xmlctrl
Imports xhtmlctrl
Imports wfileis.data
Imports avacom

Public Class avatar
    Inherits container

    Public Sub setData(ByVal info As info)
        If info Is Nothing Then
            setData(convertor.cast(Of String)(Nothing))
        Else
            setData(info.id)
        End If
    End Sub

    Public Sub setData(ByVal id As String)
        Const height As Int64 = 45
        Const width As Int64 = 40
        Dim context As httpContext
        context = httpServer2.currentContext()
        Dim a As a = Nothing
        a = context.createControl(New a())
        a.href = configDelegate.avatarServerUrl
        addchild(a)
        Dim img As img = Nothing
        img = context.createControl(New img())
        img.src = urlgenerator.portrait(configDelegate.avatarServerUrl, id, height:=height, width:=width)
        img.height = height
        img.width = width
        a.addchild(img)
    End Sub
End Class
